import { IsBoolean, IsEmail, IsNotEmpty, IsNumber, Length, MaxLength, MinLength, Validate, ValidateIf } from "class-validator";
import { MyValidator } from "../../myValidator";
import { MyContains } from "../../my-contains.decorator";

export class CreateAaa5Dto {
    @IsNotEmpty()
    @MinLength(4)
    @MaxLength(20)
    name: string;

    @IsNotEmpty()
    @IsNumber()
    age: number;

    @IsNotEmpty()
    @IsBoolean()
    sex: boolean;

    @IsNotEmpty()
    @IsEmail()
    email: string;

    @ValidateIf(obj => obj.name === 'abin')
    hoobies: string[]

    // @Validate(MyValidator, [111], {
    //     message: '必须包含111'
    // })
    @MyContains('111', {
        message: '必须包含111'
    })
    @IsNotEmpty()
    xxx: string
}
